﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace IAC_2013
{
    public partial class StartControl : DevComponents.DotNetBar.Controls.SlidePanel
    {
        public StartControl()
        {
            InitializeComponent();
        }

        private MetroBillCommands _Commands;
        public MetroBillCommands Commands
        {
            get { return _Commands; }
            set 
            {
                if (value != _Commands)
                {
                    MetroBillCommands oldValue = _Commands;
                    _Commands = value;
                    OnCommandsChanged(oldValue, value);
                }
            }
        }
        protected virtual void OnCommandsChanged(MetroBillCommands oldValue, MetroBillCommands newValue)
        {
            if (newValue != null)
            {
                newCustomerTile.Command = newValue.Customer.New;
                newInventoryTile.Command = newValue.Inventory.New;
                newInvoiceInTile.Command = newValue.InvoiceIn.New;
                newInvoiceOutTile.Command = newValue.InvoiceOut.New;
                newPartnersTile.Command = newValue.Partners.New;
                newProductTile.Command = newValue.Products.New;
                newBaseUnitTile.Command = newValue.BaseUnit.New;
                
            }
            else
            {
                newProductTile.Command = null;
                newPartnersTile.Command = null;
                newCustomerTile.Command = null;
                newInventoryTile.Command = null;
                newInvoiceInTile.Command = null;
                newInvoiceOutTile.Command = null;
                newBaseUnitTile.Command = null;
            }
        }
    }
}
